<!DOCTYPE html>
<html lang="en" ng-app="DG">
<head>
    <meta charset="UTF-8">
    <title>动态生成</title>
    <script src="../angular/angular.js"></script>
</head>
<body ng-controller="dynamicGeneration">
<table style="width: 100%">
    <thead>
    <tr>
        <th class="sortable" style="width: 5%"></th>
        <th class="sortable" style="width: 20%">编号</th>
        <th class="sortable" style="width:20%">姓名</th>
        <th class="sortable" style="width: 14.7%">性别</th>
        <th class="sortable" style="width:19%">薪资</th>
        <th class="sortable" style="width: 20%">年龄</th>
        <th class="sortable" style="width: 5%"></th>
    </tr>
    </thead>
    <tr class="color head"><td colspan="7" style="width: 100%"></td></tr>
    <tr>
        <td colspan="7">
            <div class="scrollTable">
                <table style="width: 100%;">
                    <tbody class="trheight">
                        <tr style="height: 10px" ng-repeat="list in lists">
                            <td id={{list.id}} style="width: 5%">
                                <!--<div class="buttons" ng-show="!rowform.$visible">-->
                                    <button class="btn btn-sm btn-danger" type="button" ng-click="removeAward($index)">del</button>
                                <!--</div>-->
                            </td>
                            <td style="width: 20%"><input type="text" ng-model="list.user_id"/></td>
                            <td style="width:20%"><input type="text" ng-model="list.name"/></td>
                            <td style="width: 15%"><input type="text" ng-model="list.sex"/></td>
                            <td style="width:20%"><input type="text" ng-model="list.money"/></td>
                            <td style="width: 20%"><input type="text" ng-model="list.age"/></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </td>
    </tr>
</table>
<button ng-click="addDG()">添加</button>
<p>{{lists}}</p>
<script>
    var app = angular.module('DG',[]);
    app.controller('dynamicGeneration',["$scope",function($scope){
        $scope.lists = [{
            'user_id': '',
                'id': '',
                'name': '',
                'sex': '',
                'money':'',
                'age': ''
        }]
        $scope.addDG = function(){
            $scope.inserted = {
                "user_id": '',
                "id": '',
                "name": '',
                "sex": '',
                "money": '',
                "age": ''
            }
            $scope.lists.push($scope.inserted);
        }
        $scope.removeAward = function(index) {
            $scope.lists.splice(index, 1);
        };
    }])
</script>
</body>
</html>